<template>
    <div class="common-map">
        <div :id="options.id" :style="{ 'height': options.mapHeight + 'px' }" v-loading="options.isLoading" v-if="options"></div>
    </div>
</template>

<script>
import BMap from 'BMap'

export default {
    name: 'CommonMap',
    props: {          
        options: {
            type: Object,
            required: true
        }   
    },
    data () {
        return {
            map: null
        }
    },
    methods: {
        // 初始化 - commonMap
        initCommonMap() {
            if(this.options) {
                this.map = new BMap.Map(this.options.id)  
                this.map.centerAndZoom(new BMap.Point(116.404, 39.915), 15)
            }           
        }
    },
    mounted () {
        this.initCommonMap()
    }
}
</script>

<style scoped>
.common-map {
    border-top: 1px solid #ebeef5;
    border-bottom: 1px solid #ebeef5;
    padding: 20px 10px
}
</style>
